#ifndef CSUPBR_MATERIAL_H
#define CSUPBR_MATERIAL_H

#include "transform.h"

#include <memory>

namespace csupbr {

    struct BSDF;
    struct Intersection;
    struct Texture;

    struct Shader {
        Shader(const Spectrum &Kd = {.7f, .7f, .7f});

        virtual Spectrum shading(Intersection &isct) const;
        
        float intensity = 1.f;
        Spectrum Kd, Ks;
        std::shared_ptr<Texture> tex_d = nullptr;
        std::shared_ptr<Texture> tex_r = nullptr;
        std::shared_ptr<Texture> tex_n = nullptr;
    };

    struct SkyBoxShader : Shader {
        Spectrum getSky(Vec3f direct, const Point2f& sample) const;
        float roughness = 0.f;
    };

    struct Material {
        Material(std::shared_ptr<Shader> shader, std::shared_ptr<BSDF> bsdf);
        std::shared_ptr<Shader> shader;
        std::shared_ptr<BSDF> bsdf;
    };

}

#endif